﻿

using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace org.mayb.Fixtures.Parser
{
    // $ANTLR 3.1.2 /Users/marcel/Fixture.g 2009-03-26 11:11:00

    // The variable 'variable' is assigned but its value is never used.
#pragma warning disable 168, 219
    // Unreachable code detected.
#pragma warning disable 162

    using System.Collections;


    using System;
    using Antlr.Runtime;
    using IList = System.Collections.IList;
    using ArrayList = System.Collections.ArrayList;
    using Stack = Antlr.Runtime.Collections.StackList;


    public partial class FixtureParser : Parser
    {
        public static readonly string[] tokenNames = new string[] 
	{
        "<invalid>", 
		"<EOR>", 
		"<DOWN>", 
		"<UP>", 
		"LBRACE", 
		"RBRACE", 
		"COMMA", 
		"IDENT", 
		"COLON", 
		"EQUAL", 
		"LBRACKET", 
		"RBRACKET", 
		"REFERENCE", 
		"STRING", 
		"STRING2", 
		"INTEGER", 
		"HEX_VALUE", 
		"DECIMAL", 
		"DATE", 
		"HASH", 
		"PERCENT", 
		"DOLLAR", 
		"LETTER", 
		"SYMBOL", 
		"DIGIT", 
		"WHITESPACE", 
		"COMMENT", 
		"STRING_ESCAPE", 
		"AT", 
		"STRING2_ESCAPE", 
		"MINUS", 
		"HEX_PREFIX", 
		"SLASH", 
		"ESCAPE_CHAR"
    };

        public const int COMMA = 6;
        public const int MINUS = 30;
        public const int LETTER = 22;
        public const int STRING2_ESCAPE = 29;
        public const int PERCENT = 20;
        public const int IDENT = 7;
        public const int HASH = 19;
        public const int SLASH = 32;
        public const int STRING = 13;
        public const int COMMENT = 26;
        public const int DOLLAR = 21;
        public const int LBRACKET = 10;
        public const int DECIMAL = 17;
        public const int STRING_ESCAPE = 27;
        public const int WHITESPACE = 25;
        public const int LBRACE = 4;
        public const int RBRACE = 5;
        public const int INTEGER = 15;
        public const int ESCAPE_CHAR = 33;
        public const int EQUAL = 9;
        public const int EOF = -1;
        public const int RBRACKET = 11;
        public const int REFERENCE = 12;
        public const int DATE = 18;
        public const int SYMBOL = 23;
        public const int HEX_VALUE = 16;
        public const int COLON = 8;
        public const int HEX_PREFIX = 31;
        public const int DIGIT = 24;
        public const int STRING2 = 14;
        public const int AT = 28;

        // delegates
        // delegators


        public override void ReportError(RecognitionException e)
        {
            ReportError(e, "");
        }

        public void ReportError(RecognitionException e, string tabs)
        {
            base.ReportError(e);
            errorLog.Append(tabs + e.Message + "\n");
            errorLog.Append(tabs + string.Format("\tLocated at {0}:{1}\n", e.Line, e.CharPositionInLine));
            if (e.InnerException is RecognitionException)
                ReportError((RecognitionException)e.InnerException, "\t" + tabs);
        }

        public StringBuilder errorLog = new StringBuilder();

        public FixtureParser(ITokenStream input, List<ObjectInfo> objs, List<string> ids)
            : this(input, new RecognizerSharedState(), objs, ids)
        {

        }

        public FixtureParser(ITokenStream input, RecognizerSharedState state, List<ObjectInfo> objs, List<string> ids)
            : base(input, state)
        {
            InitializeCyclicDFAs();
            objects = objs;
            usedIDs = ids;
        }

        override public string[] TokenNames
        {
            get { return FixtureParser.tokenNames; }
        }

        override public string GrammarFileName
        {
            get { return "/Users/marcel/Fixture.g"; }
        }


        List<ObjectInfo> objects;
        List<string> usedIDs;

        public string ProcessString(string value)
        {
            value = value.Substring(1);
            value = value.Substring(0, value.Length - 1);

            Regex rex = new Regex("\\\\[nrt\\\\\\\"]");

            Match match = rex.Match(value);
            while (match != null && match.Value != "")
            {
                string front = value.Substring(0, match.Index);
                string middle = "";
                switch (match.Value)
                {
                    case "\\n":
                        middle += "\n";
                        break;
                    case "\\r":
                        middle += "\r";
                        break;
                    case "\\t":
                        middle += "\t";
                        break;
                    case "\\\\":
                        middle += "\\";
                        break;
                    case "\\\"":
                        middle += "\"";
                        break;
                    default:
                        middle = match.Value;
                        break;
                }
                string end = value.Substring(match.Index + match.Length);
                value = front + middle + end;
                match = match.Index + 1 <= value.Length ? rex.Match(value, match.Index + 1) : null;
            }

            return value;
        }

        public string ProcessString2(string value)
        {
            value = value.Substring(2);
            value = value.Substring(0, value.Length - 1);

            Regex rex = new Regex("\\\\[nrt\\\\\\{\\}]");

            Match match = rex.Match(value);
            while (match != null && match.Value != "")
            {
                string front = value.Substring(0, match.Index);
                string middle = "";
                switch (match.Value)
                {
                    case "\\n":
                        middle += "\n";
                        break;
                    case "\\r":
                        middle += "\r";
                        break;
                    case "\\t":
                        middle += "\t";
                        break;
                    case "\\\\":
                        middle += "\\";
                        break;
                    case "\\{":
                        middle += "{";
                        break;
                    case "\\}":
                        middle += "}";
                        break;
                    default:
                        middle = match.Value;
                        break;
                }
                string end = value.Substring(match.Index + match.Length);
                value = front + middle + end;
                match = match.Index + 1 <= value.Length ? rex.Match(value, match.Index + 1) : null;
            }

            return value;
        }



        // $ANTLR start "top"
        // /Users/marcel/Fixture.g:105:1: top : ( obj )* ;
        public void top() // throws RecognitionException [1]
        {
            try
            {
                // /Users/marcel/Fixture.g:105:5: ( ( obj )* )
                // /Users/marcel/Fixture.g:105:7: ( obj )*
                {
                    // /Users/marcel/Fixture.g:105:7: ( obj )*
                    do
                    {
                        int alt1 = 2;
                        int LA1_0 = input.LA(1);

                        if ((LA1_0 == IDENT))
                        {
                            alt1 = 1;
                        }


                        switch (alt1)
                        {
                            case 1:
                                // /Users/marcel/Fixture.g:105:8: obj
                                {
                                    PushFollow(FOLLOW_obj_in_top41);
                                    obj();
                                    state.followingStackPointer--;


                                }
                                break;

                            default:
                                goto loop1;
                        }
                    } while (true);

                loop1:
                    ;	// Stops C# compiler whining that label 'loop1' has no statements


                }

            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return;
        }
        // $ANTLR end "top"


        // $ANTLR start "property_hash"
        // /Users/marcel/Fixture.g:107:1: property_hash returns [PropertyHash hash = new PropertyHash()] : ( ( LBRACE RBRACE ) | ( LBRACE property[hash] ( COMMA property[hash] )* RBRACE ) );
        public PropertyHash property_hash() // throws RecognitionException [1]
        {
            PropertyHash hash = new PropertyHash();

            try
            {
                // /Users/marcel/Fixture.g:107:63: ( ( LBRACE RBRACE ) | ( LBRACE property[hash] ( COMMA property[hash] )* RBRACE ) )
                int alt3 = 2;
                int LA3_0 = input.LA(1);

                if ((LA3_0 == LBRACE))
                {
                    int LA3_1 = input.LA(2);

                    if ((LA3_1 == RBRACE))
                    {
                        alt3 = 1;
                    }
                    else if ((LA3_1 == IDENT))
                    {
                        alt3 = 2;
                    }
                    else
                    {
                        NoViableAltException nvae_d3s1 =
                            new NoViableAltException("", 3, 1, input);

                        throw nvae_d3s1;
                    }
                }
                else
                {
                    NoViableAltException nvae_d3s0 =
                        new NoViableAltException("", 3, 0, input);

                    throw nvae_d3s0;
                }
                switch (alt3)
                {
                    case 1:
                        // /Users/marcel/Fixture.g:108:2: ( LBRACE RBRACE )
                        {
                            // /Users/marcel/Fixture.g:108:2: ( LBRACE RBRACE )
                            // /Users/marcel/Fixture.g:108:3: LBRACE RBRACE
                            {
                                Match(input, LBRACE, FOLLOW_LBRACE_in_property_hash57);
                                Match(input, RBRACE, FOLLOW_RBRACE_in_property_hash59);

                            }


                        }
                        break;
                    case 2:
                        // /Users/marcel/Fixture.g:109:2: ( LBRACE property[hash] ( COMMA property[hash] )* RBRACE )
                        {
                            // /Users/marcel/Fixture.g:109:2: ( LBRACE property[hash] ( COMMA property[hash] )* RBRACE )
                            // /Users/marcel/Fixture.g:109:3: LBRACE property[hash] ( COMMA property[hash] )* RBRACE
                            {
                                Match(input, LBRACE, FOLLOW_LBRACE_in_property_hash67);
                                PushFollow(FOLLOW_property_in_property_hash72);
                                property(hash);
                                state.followingStackPointer--;

                                // /Users/marcel/Fixture.g:111:3: ( COMMA property[hash] )*
                                do
                                {
                                    int alt2 = 2;
                                    int LA2_0 = input.LA(1);

                                    if ((LA2_0 == COMMA))
                                    {
                                        alt2 = 1;
                                    }


                                    switch (alt2)
                                    {
                                        case 1:
                                            // /Users/marcel/Fixture.g:111:4: COMMA property[hash]
                                            {
                                                Match(input, COMMA, FOLLOW_COMMA_in_property_hash79);
                                                PushFollow(FOLLOW_property_in_property_hash81);
                                                property(hash);
                                                state.followingStackPointer--;


                                            }
                                            break;

                                        default:
                                            goto loop2;
                                    }
                                } while (true);

                            loop2:
                                ;	// Stops C# compiler whining that label 'loop2' has no statements

                                Match(input, RBRACE, FOLLOW_RBRACE_in_property_hash88);

                            }


                        }
                        break;

                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return hash;
        }
        // $ANTLR end "property_hash"


        // $ANTLR start "property"
        // /Users/marcel/Fixture.g:114:1: property[PropertyHash hash] : name= IDENT COLON val= value ;
        public void property(PropertyHash hash) // throws RecognitionException [1]
        {
            IToken name = null;
            object val = default(object);


            try
            {
                // /Users/marcel/Fixture.g:115:2: (name= IDENT COLON val= value )
                // /Users/marcel/Fixture.g:116:3: name= IDENT COLON val= value
                {
                    name = (IToken)Match(input, IDENT, FOLLOW_IDENT_in_property103);
                    Match(input, COLON, FOLLOW_COLON_in_property105);
                    PushFollow(FOLLOW_value_in_property109);
                    val = value();
                    state.followingStackPointer--;

                    hash.AddProperty(name.Text, val);

                }

            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return;
        }
        // $ANTLR end "property"


        // $ANTLR start "basic_property_hash"
        // /Users/marcel/Fixture.g:120:1: basic_property_hash returns [ PropertyHash hash = new PropertyHash()] : ( ( LBRACE RBRACE ) | ( LBRACE basic_property[hash] ( COMMA basic_property[hash] )* RBRACE ) );
        public PropertyHash basic_property_hash() // throws RecognitionException [1]
        {
            PropertyHash hash = new PropertyHash();

            try
            {
                // /Users/marcel/Fixture.g:120:70: ( ( LBRACE RBRACE ) | ( LBRACE basic_property[hash] ( COMMA basic_property[hash] )* RBRACE ) )
                int alt5 = 2;
                int LA5_0 = input.LA(1);

                if ((LA5_0 == LBRACE))
                {
                    int LA5_1 = input.LA(2);

                    if ((LA5_1 == RBRACE))
                    {
                        alt5 = 1;
                    }
                    else if ((LA5_1 == IDENT))
                    {
                        alt5 = 2;
                    }
                    else
                    {
                        NoViableAltException nvae_d5s1 =
                            new NoViableAltException("", 5, 1, input);

                        throw nvae_d5s1;
                    }
                }
                else
                {
                    NoViableAltException nvae_d5s0 =
                        new NoViableAltException("", 5, 0, input);

                    throw nvae_d5s0;
                }
                switch (alt5)
                {
                    case 1:
                        // /Users/marcel/Fixture.g:121:2: ( LBRACE RBRACE )
                        {
                            // /Users/marcel/Fixture.g:121:2: ( LBRACE RBRACE )
                            // /Users/marcel/Fixture.g:121:3: LBRACE RBRACE
                            {
                                Match(input, LBRACE, FOLLOW_LBRACE_in_basic_property_hash128);
                                Match(input, RBRACE, FOLLOW_RBRACE_in_basic_property_hash130);

                            }


                        }
                        break;
                    case 2:
                        // /Users/marcel/Fixture.g:122:2: ( LBRACE basic_property[hash] ( COMMA basic_property[hash] )* RBRACE )
                        {
                            // /Users/marcel/Fixture.g:122:2: ( LBRACE basic_property[hash] ( COMMA basic_property[hash] )* RBRACE )
                            // /Users/marcel/Fixture.g:122:3: LBRACE basic_property[hash] ( COMMA basic_property[hash] )* RBRACE
                            {
                                Match(input, LBRACE, FOLLOW_LBRACE_in_basic_property_hash137);
                                PushFollow(FOLLOW_basic_property_in_basic_property_hash141);
                                basic_property(hash);
                                state.followingStackPointer--;

                                // /Users/marcel/Fixture.g:124:3: ( COMMA basic_property[hash] )*
                                do
                                {
                                    int alt4 = 2;
                                    int LA4_0 = input.LA(1);

                                    if ((LA4_0 == COMMA))
                                    {
                                        alt4 = 1;
                                    }


                                    switch (alt4)
                                    {
                                        case 1:
                                            // /Users/marcel/Fixture.g:124:4: COMMA basic_property[hash]
                                            {
                                                Match(input, COMMA, FOLLOW_COMMA_in_basic_property_hash147);
                                                PushFollow(FOLLOW_basic_property_in_basic_property_hash149);
                                                basic_property(hash);
                                                state.followingStackPointer--;


                                            }
                                            break;

                                        default:
                                            goto loop4;
                                    }
                                } while (true);

                            loop4:
                                ;	// Stops C# compiler whining that label 'loop4' has no statements

                                Match(input, RBRACE, FOLLOW_RBRACE_in_basic_property_hash155);

                            }


                        }
                        break;

                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return hash;
        }
        // $ANTLR end "basic_property_hash"


        // $ANTLR start "basic_property"
        // /Users/marcel/Fixture.g:127:1: basic_property[PropertyHash hash] : name= IDENT COLON val= basic_value ;
        public void basic_property(PropertyHash hash) // throws RecognitionException [1]
        {
            IToken name = null;
            object val = default(object);


            try
            {
                // /Users/marcel/Fixture.g:128:2: (name= IDENT COLON val= basic_value )
                // /Users/marcel/Fixture.g:129:3: name= IDENT COLON val= basic_value
                {
                    name = (IToken)Match(input, IDENT, FOLLOW_IDENT_in_basic_property170);
                    Match(input, COLON, FOLLOW_COLON_in_basic_property172);
                    PushFollow(FOLLOW_basic_value_in_basic_property176);
                    val = basic_value();
                    state.followingStackPointer--;

                    hash.AddProperty(name.Text, val);

                }

            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return;
        }
        // $ANTLR end "basic_property"


        // $ANTLR start "obj"
        // /Users/marcel/Fixture.g:133:1: obj returns [ObjectReference refer = null] : (ident= IDENT EQUAL )? type= IDENT hash= property_hash ;
        public ObjectReference obj() // throws RecognitionException [1]
        {
            ObjectReference refer = null;

            IToken ident = null;
            IToken type = null;
            PropertyHash hash = default(PropertyHash);


            try
            {
                // /Users/marcel/Fixture.g:133:44: ( (ident= IDENT EQUAL )? type= IDENT hash= property_hash )
                // /Users/marcel/Fixture.g:134:2: (ident= IDENT EQUAL )? type= IDENT hash= property_hash
                {

                    ObjectInfo info = new ObjectInfo();
                    info.ID = System.Guid.NewGuid().ToString();

                    // /Users/marcel/Fixture.g:138:2: (ident= IDENT EQUAL )?
                    int alt6 = 2;
                    int LA6_0 = input.LA(1);

                    if ((LA6_0 == IDENT))
                    {
                        int LA6_1 = input.LA(2);

                        if ((LA6_1 == EQUAL))
                        {
                            alt6 = 1;
                        }
                    }
                    switch (alt6)
                    {
                        case 1:
                            // /Users/marcel/Fixture.g:138:3: ident= IDENT EQUAL
                            {
                                ident = (IToken)Match(input, IDENT, FOLLOW_IDENT_in_obj201);
                                Match(input, EQUAL, FOLLOW_EQUAL_in_obj203);

                                info.ID = ident.Text;
                                if (usedIDs.Contains(info.ID))
                                    throw new Exception(string.Format("Duplicate ID: {0} in {1}", info.ID, input.TokenSource.SourceName));

                                usedIDs.Add(info.ID);


                            }
                            break;

                    }

                    type = (IToken)Match(input, IDENT, FOLLOW_IDENT_in_obj218);

                    info.Type = type.Text;
                    info.File = this.TokenStream.TokenSource.SourceName;
                    info.Line = type.Line;
                    info.Char = type.CharPositionInLine;

                    PushFollow(FOLLOW_property_hash_in_obj230);
                    hash = property_hash();
                    state.followingStackPointer--;

                    info.Properties = hash;
                    refer = new ObjectReference(info);
                    objects.Add(info);

                }

            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return refer;
        }
        // $ANTLR end "obj"


        // $ANTLR start "array"
        // /Users/marcel/Fixture.g:159:1: array returns [ArrayInfo array = new ArrayInfo()] : ( ( LBRACKET RBRACKET ) | ( LBRACKET v= value ( COMMA v= value )* RBRACKET ) );
        public ArrayInfo array() // throws RecognitionException [1]
        {
            ArrayInfo array = new ArrayInfo();

            object v = default(object);


            try
            {
                // /Users/marcel/Fixture.g:159:51: ( ( LBRACKET RBRACKET ) | ( LBRACKET v= value ( COMMA v= value )* RBRACKET ) )
                int alt8 = 2;
                int LA8_0 = input.LA(1);

                if ((LA8_0 == LBRACKET))
                {
                    int LA8_1 = input.LA(2);

                    if ((LA8_1 == RBRACKET))
                    {
                        alt8 = 1;
                    }
                    else if ((LA8_1 == LBRACE || LA8_1 == IDENT || LA8_1 == LBRACKET || (LA8_1 >= REFERENCE && LA8_1 <= PERCENT)))
                    {
                        alt8 = 2;
                    }
                    else
                    {
                        NoViableAltException nvae_d8s1 =
                            new NoViableAltException("", 8, 1, input);

                        throw nvae_d8s1;
                    }
                }
                else
                {
                    NoViableAltException nvae_d8s0 =
                        new NoViableAltException("", 8, 0, input);

                    throw nvae_d8s0;
                }
                switch (alt8)
                {
                    case 1:
                        // /Users/marcel/Fixture.g:160:2: ( LBRACKET RBRACKET )
                        {
                            // /Users/marcel/Fixture.g:160:2: ( LBRACKET RBRACKET )
                            // /Users/marcel/Fixture.g:160:3: LBRACKET RBRACKET
                            {
                                Match(input, LBRACKET, FOLLOW_LBRACKET_in_array255);
                                Match(input, RBRACKET, FOLLOW_RBRACKET_in_array257);

                            }


                        }
                        break;
                    case 2:
                        // /Users/marcel/Fixture.g:161:2: ( LBRACKET v= value ( COMMA v= value )* RBRACKET )
                        {
                            // /Users/marcel/Fixture.g:161:2: ( LBRACKET v= value ( COMMA v= value )* RBRACKET )
                            // /Users/marcel/Fixture.g:161:3: LBRACKET v= value ( COMMA v= value )* RBRACKET
                            {
                                Match(input, LBRACKET, FOLLOW_LBRACKET_in_array265);
                                PushFollow(FOLLOW_value_in_array272);
                                v = value();
                                state.followingStackPointer--;

                                array.Add(v);
                                // /Users/marcel/Fixture.g:163:3: ( COMMA v= value )*
                                do
                                {
                                    int alt7 = 2;
                                    int LA7_0 = input.LA(1);

                                    if ((LA7_0 == COMMA))
                                    {
                                        alt7 = 1;
                                    }


                                    switch (alt7)
                                    {
                                        case 1:
                                            // /Users/marcel/Fixture.g:163:4: COMMA v= value
                                            {
                                                Match(input, COMMA, FOLLOW_COMMA_in_array280);
                                                PushFollow(FOLLOW_value_in_array284);
                                                v = value();
                                                state.followingStackPointer--;

                                                array.Add(v);

                                            }
                                            break;

                                        default:
                                            goto loop7;
                                    }
                                } while (true);

                            loop7:
                                ;	// Stops C# compiler whining that label 'loop7' has no statements

                                Match(input, RBRACKET, FOLLOW_RBRACKET_in_array292);

                            }


                        }
                        break;

                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return array;
        }
        // $ANTLR end "array"


        // $ANTLR start "value"
        // /Users/marcel/Fixture.g:166:1: value returns [object val = null] : (refer= REFERENCE | basicValue= basic_value | arrayValue= array | objectValue= obj | propHash= property_hash | search= searcher );
        public object value() // throws RecognitionException [1]
        {
            object val = null;

            IToken refer = null;
            object basicValue = default(object);

            ArrayInfo arrayValue = default(ArrayInfo);

            ObjectReference objectValue = default(ObjectReference);

            PropertyHash propHash = default(PropertyHash);

            SearchInfo search = default(SearchInfo);


            try
            {
                // /Users/marcel/Fixture.g:166:35: (refer= REFERENCE | basicValue= basic_value | arrayValue= array | objectValue= obj | propHash= property_hash | search= searcher )
                int alt9 = 6;
                switch (input.LA(1))
                {
                    case REFERENCE:
                        {
                            alt9 = 1;
                        }
                        break;
                    case STRING:
                    case STRING2:
                    case INTEGER:
                    case HEX_VALUE:
                    case DECIMAL:
                    case DATE:
                        {
                            alt9 = 2;
                        }
                        break;
                    case IDENT:
                        {
                            int LA9_3 = input.LA(2);

                            if ((LA9_3 == LBRACE || LA9_3 == EQUAL))
                            {
                                alt9 = 4;
                            }
                            else if (((LA9_3 >= RBRACE && LA9_3 <= COMMA) || LA9_3 == RBRACKET))
                            {
                                alt9 = 2;
                            }
                            else
                            {
                                NoViableAltException nvae_d9s3 =
                                    new NoViableAltException("", 9, 3, input);

                                throw nvae_d9s3;
                            }
                        }
                        break;
                    case LBRACKET:
                        {
                            alt9 = 3;
                        }
                        break;
                    case LBRACE:
                        {
                            alt9 = 5;
                        }
                        break;
                    case HASH:
                    case PERCENT:
                        {
                            alt9 = 6;
                        }
                        break;
                    default:
                        NoViableAltException nvae_d9s0 =
                            new NoViableAltException("", 9, 0, input);

                        throw nvae_d9s0;
                }

                switch (alt9)
                {
                    case 1:
                        // /Users/marcel/Fixture.g:167:2: refer= REFERENCE
                        {
                            refer = (IToken)Match(input, REFERENCE, FOLLOW_REFERENCE_in_value309);
                            val = new ObjectReference(refer.Text);

                        }
                        break;
                    case 2:
                        // /Users/marcel/Fixture.g:168:2: basicValue= basic_value
                        {
                            PushFollow(FOLLOW_basic_value_in_value321);
                            basicValue = basic_value();
                            state.followingStackPointer--;

                            val = basicValue;

                        }
                        break;
                    case 3:
                        // /Users/marcel/Fixture.g:169:2: arrayValue= array
                        {
                            PushFollow(FOLLOW_array_in_value330);
                            arrayValue = array();
                            state.followingStackPointer--;

                            val = arrayValue;

                        }
                        break;
                    case 4:
                        // /Users/marcel/Fixture.g:170:2: objectValue= obj
                        {
                            PushFollow(FOLLOW_obj_in_value340);
                            objectValue = obj();
                            state.followingStackPointer--;

                            val = objectValue;

                        }
                        break;
                    case 5:
                        // /Users/marcel/Fixture.g:171:2: propHash= property_hash
                        {
                            PushFollow(FOLLOW_property_hash_in_value349);
                            propHash = property_hash();
                            state.followingStackPointer--;

                            val = propHash;

                        }
                        break;
                    case 6:
                        // /Users/marcel/Fixture.g:172:2: search= searcher
                        {
                            PushFollow(FOLLOW_searcher_in_value358);
                            search = searcher();
                            state.followingStackPointer--;

                            val = search;

                        }
                        break;

                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return val;
        }
        // $ANTLR end "value"


        // $ANTLR start "basic_value"
        // /Users/marcel/Fixture.g:175:1: basic_value returns [object val = null] : (basic= STRING | basic= STRING2 | basic= INTEGER | basic= HEX_VALUE | basic= DECIMAL | basic= IDENT | basic= DATE );
        public object basic_value() // throws RecognitionException [1]
        {
            object val = null;

            IToken basic = null;

            try
            {
                // /Users/marcel/Fixture.g:175:40: (basic= STRING | basic= STRING2 | basic= INTEGER | basic= HEX_VALUE | basic= DECIMAL | basic= IDENT | basic= DATE )
                int alt10 = 7;
                switch (input.LA(1))
                {
                    case STRING:
                        {
                            alt10 = 1;
                        }
                        break;
                    case STRING2:
                        {
                            alt10 = 2;
                        }
                        break;
                    case INTEGER:
                        {
                            alt10 = 3;
                        }
                        break;
                    case HEX_VALUE:
                        {
                            alt10 = 4;
                        }
                        break;
                    case DECIMAL:
                        {
                            alt10 = 5;
                        }
                        break;
                    case IDENT:
                        {
                            alt10 = 6;
                        }
                        break;
                    case DATE:
                        {
                            alt10 = 7;
                        }
                        break;
                    default:
                        NoViableAltException nvae_d10s0 =
                            new NoViableAltException("", 10, 0, input);

                        throw nvae_d10s0;
                }

                switch (alt10)
                {
                    case 1:
                        // /Users/marcel/Fixture.g:176:3: basic= STRING
                        {
                            basic = (IToken)Match(input, STRING, FOLLOW_STRING_in_basic_value378);
                            val = ProcessString(basic.Text);

                        }
                        break;
                    case 2:
                        // /Users/marcel/Fixture.g:177:3: basic= STRING2
                        {
                            basic = (IToken)Match(input, STRING2, FOLLOW_STRING2_in_basic_value389);
                            val = ProcessString2(basic.Text);

                        }
                        break;
                    case 3:
                        // /Users/marcel/Fixture.g:178:3: basic= INTEGER
                        {
                            basic = (IToken)Match(input, INTEGER, FOLLOW_INTEGER_in_basic_value400);
                            val = basic.Text;

                        }
                        break;
                    case 4:
                        // /Users/marcel/Fixture.g:179:3: basic= HEX_VALUE
                        {
                            basic = (IToken)Match(input, HEX_VALUE, FOLLOW_HEX_VALUE_in_basic_value411);
                            val = basic.Text;

                        }
                        break;
                    case 5:
                        // /Users/marcel/Fixture.g:180:3: basic= DECIMAL
                        {
                            basic = (IToken)Match(input, DECIMAL, FOLLOW_DECIMAL_in_basic_value422);
                            val = basic.Text;

                        }
                        break;
                    case 6:
                        // /Users/marcel/Fixture.g:181:3: basic= IDENT
                        {
                            basic = (IToken)Match(input, IDENT, FOLLOW_IDENT_in_basic_value433);
                            val = basic.Text;

                        }
                        break;
                    case 7:
                        // /Users/marcel/Fixture.g:182:3: basic= DATE
                        {
                            basic = (IToken)Match(input, DATE, FOLLOW_DATE_in_basic_value444);
                            val = basic.Text;

                        }
                        break;

                }
            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return val;
        }
        // $ANTLR end "basic_value"


        // $ANTLR start "searcher"
        // /Users/marcel/Fixture.g:185:1: searcher returns [SearchInfo info = new SearchInfo()] : ( HASH | PERCENT ) ident= IDENT temp= basic_property_hash ;
        public SearchInfo searcher() // throws RecognitionException [1]
        {
            SearchInfo info = new SearchInfo();

            IToken ident = null;
            PropertyHash temp = default(PropertyHash);


            try
            {
                // /Users/marcel/Fixture.g:185:54: ( ( HASH | PERCENT ) ident= IDENT temp= basic_property_hash )
                // /Users/marcel/Fixture.g:186:2: ( HASH | PERCENT ) ident= IDENT temp= basic_property_hash
                {
                    // /Users/marcel/Fixture.g:186:2: ( HASH | PERCENT )
                    int alt11 = 2;
                    int LA11_0 = input.LA(1);

                    if ((LA11_0 == HASH))
                    {
                        alt11 = 1;
                    }
                    else if ((LA11_0 == PERCENT))
                    {
                        alt11 = 2;
                    }
                    else
                    {
                        NoViableAltException nvae_d11s0 =
                            new NoViableAltException("", 11, 0, input);

                        throw nvae_d11s0;
                    }
                    switch (alt11)
                    {
                        case 1:
                            // /Users/marcel/Fixture.g:186:3: HASH
                            {
                                Match(input, HASH, FOLLOW_HASH_in_searcher461);
                                info.SearchType = SearchType.Collection;

                            }
                            break;
                        case 2:
                            // /Users/marcel/Fixture.g:186:55: PERCENT
                            {
                                Match(input, PERCENT, FOLLOW_PERCENT_in_searcher467);
                                info.SearchType = SearchType.Single;

                            }
                            break;

                    }

                    ident = (IToken)Match(input, IDENT, FOLLOW_IDENT_in_searcher475);
                    info.Type = ident.Text;
                    PushFollow(FOLLOW_basic_property_hash_in_searcher484);
                    temp = basic_property_hash();
                    state.followingStackPointer--;

                    info.Properties = temp;

                }

            }
            catch (RecognitionException re)
            {
                ReportError(re);
                Recover(input, re);
            }
            finally
            {
            }
            return info;
        }
        // $ANTLR end "searcher"

        // Delegated rules


        private void InitializeCyclicDFAs()
        {
        }



        public static readonly BitSet FOLLOW_obj_in_top41 = new BitSet(new ulong[] { 0x0000000000000082UL });
        public static readonly BitSet FOLLOW_LBRACE_in_property_hash57 = new BitSet(new ulong[] { 0x0000000000000020UL });
        public static readonly BitSet FOLLOW_RBRACE_in_property_hash59 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_LBRACE_in_property_hash67 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_property_in_property_hash72 = new BitSet(new ulong[] { 0x0000000000000060UL });
        public static readonly BitSet FOLLOW_COMMA_in_property_hash79 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_property_in_property_hash81 = new BitSet(new ulong[] { 0x0000000000000060UL });
        public static readonly BitSet FOLLOW_RBRACE_in_property_hash88 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_IDENT_in_property103 = new BitSet(new ulong[] { 0x0000000000000100UL });
        public static readonly BitSet FOLLOW_COLON_in_property105 = new BitSet(new ulong[] { 0x00000000001FF490UL });
        public static readonly BitSet FOLLOW_value_in_property109 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_LBRACE_in_basic_property_hash128 = new BitSet(new ulong[] { 0x0000000000000020UL });
        public static readonly BitSet FOLLOW_RBRACE_in_basic_property_hash130 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_LBRACE_in_basic_property_hash137 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_basic_property_in_basic_property_hash141 = new BitSet(new ulong[] { 0x0000000000000060UL });
        public static readonly BitSet FOLLOW_COMMA_in_basic_property_hash147 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_basic_property_in_basic_property_hash149 = new BitSet(new ulong[] { 0x0000000000000060UL });
        public static readonly BitSet FOLLOW_RBRACE_in_basic_property_hash155 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_IDENT_in_basic_property170 = new BitSet(new ulong[] { 0x0000000000000100UL });
        public static readonly BitSet FOLLOW_COLON_in_basic_property172 = new BitSet(new ulong[] { 0x000000000007E080UL });
        public static readonly BitSet FOLLOW_basic_value_in_basic_property176 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_IDENT_in_obj201 = new BitSet(new ulong[] { 0x0000000000000200UL });
        public static readonly BitSet FOLLOW_EQUAL_in_obj203 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_IDENT_in_obj218 = new BitSet(new ulong[] { 0x0000000000000010UL });
        public static readonly BitSet FOLLOW_property_hash_in_obj230 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_LBRACKET_in_array255 = new BitSet(new ulong[] { 0x0000000000000800UL });
        public static readonly BitSet FOLLOW_RBRACKET_in_array257 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_LBRACKET_in_array265 = new BitSet(new ulong[] { 0x00000000001FF490UL });
        public static readonly BitSet FOLLOW_value_in_array272 = new BitSet(new ulong[] { 0x0000000000000840UL });
        public static readonly BitSet FOLLOW_COMMA_in_array280 = new BitSet(new ulong[] { 0x00000000001FF490UL });
        public static readonly BitSet FOLLOW_value_in_array284 = new BitSet(new ulong[] { 0x0000000000000840UL });
        public static readonly BitSet FOLLOW_RBRACKET_in_array292 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_REFERENCE_in_value309 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_basic_value_in_value321 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_array_in_value330 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_obj_in_value340 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_property_hash_in_value349 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_searcher_in_value358 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_STRING_in_basic_value378 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_STRING2_in_basic_value389 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_INTEGER_in_basic_value400 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_HEX_VALUE_in_basic_value411 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_DECIMAL_in_basic_value422 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_IDENT_in_basic_value433 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_DATE_in_basic_value444 = new BitSet(new ulong[] { 0x0000000000000002UL });
        public static readonly BitSet FOLLOW_HASH_in_searcher461 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_PERCENT_in_searcher467 = new BitSet(new ulong[] { 0x0000000000000080UL });
        public static readonly BitSet FOLLOW_IDENT_in_searcher475 = new BitSet(new ulong[] { 0x0000000000000010UL });
        public static readonly BitSet FOLLOW_basic_property_hash_in_searcher484 = new BitSet(new ulong[] { 0x0000000000000002UL });

    }

}
